package org.bite.lesson06;

/**
 * 双重检查锁DCL
 */
public class SingletonDCL {
    private static SingletonDCL instance = null;
    private SingletonDCL(){};
    /**
     * DCL双重检查锁提供获取对象的方法
     */
    public static SingletonDCL getInstance(){
        if(instance == null){
            synchronized(SingletonDCL.class){
                if(instance == null){
                    instance = new SingletonDCL();
                }
            }
        }
        return instance;
    }
}
